NodeBox

Create visual output with Python programming code
Home Download Reference Tutorial Library Gallery About

Reference | colormode()


Syntax
colormode(mode, range=1.0)

DescriptionChanges the way NodeBox interprets color data. By default, fill() and stroke() are set by values between 0.0 and 1.0 using the RGB color model. RGB corresponds to Red/Green/Blue. Alternatively HSB (Hue/Saturation/Brightness) or CMYK (Cyan/Magenta/Yellow/Black) can be specified. Regardless of which colormode is specified, PDF's are exported in CMYK so that they are ready for print. The optional range parameter specifies whether color values are defined between 0.0 and 1.0, or something else, 0 and 255 for example (range=255).
Returnsthe current color mode


Example
colormode(RGB)
fill(0.25, 0.25, 0.25)
rect(10, 10, 40, 40)

colormode(HSB)
fill(0, 0, 0.25)
rect(60, 10, 40, 40)